﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HelperInfoList.aspx.cs" Inherits="ExaminationSys.View.News.HelperInfoList" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register src="HelperInfoEdit.ascx" tagname="HelperInfoEdit" tagprefix="uc1" %>
<%@ Register src="HelperInfoSearchWindow.ascx" tagname="ExpressInfoSearch" tagprefix="uc1" %>
<%--<%@ Register src="~/View/Share/LeftUserInfoControl.ascx" tagname="LeftUserInfoControl" tagprefix="uc1" %>--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script type="text/javascript" language="javascript">
         var newsTypeEditDetailsRender = function () {
             return '<img class="ImageEdit" ext:qtip="编辑" style="cursor:pointer;" src="../../images/vcard_edit.png" />';
         };
         var template = '<span style="color:{0};">{1}</span>';
         var StatusRaw = function(value) {
             switch (value) {
             case 1:
                 return Ext.String.format(template, "green", "是");
             case 2:
                 return Ext.String.format(template, "red", "否");
             case 0:
                 return Ext.String.format(template, "red", "否");
             }
     };
     var isRecommend = function (value) {
         if (value == true)
             return Ext.String.format(template, "red", "是");
         else {
             return Ext.String.format(template, "green", "否");
         }
     };
     </script>
</head>

<body>
    <form id="Form1" runat="server">
        <ext:ResourceManager runat="server"  DirectMethodNamespace="X" />
         <ext:Store ID="StoreExpressInfo"
            runat="server" PageSize="20"
            ShowWarningOnFailure="true"
            AutoLoad="true"
            OnReadData="StoreExpressInfo_RefreshData">
            <Proxy>
                <ext:PageProxy>                    
                    <Listeners>
                        <Exception Handler="Ext.MessageBox.alert('Load failed', response.statusText);" />
                    </Listeners>
                </ext:PageProxy>
            </Proxy>
            <Model>
                <ext:Model ID="ExpressInfoModel" runat="server" IDProperty="ID">
                    <Fields>
                        <ext:ModelField Name="ID"/>
                        <ext:ModelField Name="TypeID" />
                        <ext:ModelField Name="TypeName" />
                        <ext:ModelField Name="Title" />
                        <ext:ModelField Name="Content" />
                        <ext:ModelField Name="Status" Type="Int" />
                        <ext:ModelField Name="IsRecommend" Type="Boolean" />
                        <ext:ModelField Name="Operator" />
                        <ext:ModelField Name="OperatorTime" Type="Date" />
                    </Fields>
                </ext:Model>
            </Model>
            <AutoLoadParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="20" Mode="Raw" />
            </AutoLoadParams>            
            <Sorters>
                <ext:DataSorter Property="OpeatorTime" Direction="DESC" />
            </Sorters>
            <Listeners>
                <Exception Handler="Ext.MessageBox.alert('Load failed', response.statusText);"></Exception>
            </Listeners>
        </ext:Store>
         <ext:ViewPort  runat="server" Layout="BorderLayout" >
        <Items>
        
			
        <ext:GridPanel 
            ID="GridPanelNewsType" 
            runat="server" 
             Region="Center"
            StoreID="StoreExpressInfo"             
           
           
            TrackMouseOver="true"
            AutoExpandColumn="Title"
            >
            <TopBar>
                <ext:Toolbar  runat="server">
                    <Items>
                        <ext:Button ID="BtnAdd" runat="server" Text="新增" Icon="Add">
                        <DirectEvents>
                            <Click OnEvent="Add_Click"></Click>
                        </DirectEvents>
                        </ext:Button>
                        <ext:Button ID="BtnBatchDelete" runat="server" Text="批量删除" Icon="GroupDelete">
                          <Listeners>
                            <Click Handler="X.DoConfirm()" />
                        </Listeners>
                       <%-- <DirectEvents>
                            <Click OnEvent="BatchDelete_Click"></Click>
                        </DirectEvents>--%>
                        </ext:Button>
                        <ext:Button ID="BtnBatchLock" runat="server" Text="批量锁定" Icon="LockKey">
                        <DirectEvents>
                            <Click OnEvent="BatchLock_Click"></Click>
                        </DirectEvents>
                        </ext:Button>
                        <ext:Button ID="BtnBatchUnLock" runat="server" Text="解锁" Icon="LockEdit">
                        <DirectEvents>
                            <Click OnEvent="BatchUnLock_Click"></Click>
                        </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator/>
                        <ext:TextField ID="GroupSearchText"  EmptyText="输入关键字" runat="server"></ext:TextField>
                        <ext:Button runat="server" ID="BtnGroupFind" Text="查找" Icon="Find" >                           
                               <DirectEvents>
                            <Click OnEvent="BtnGroupFind_Click"></Click>
                            </DirectEvents>                        
                        </ext:Button>                        
                        <ext:Button runat="server" ID="BtnSearch" Text="高级查找" Icon="Find" >                           
                               <DirectEvents>
                            <Click OnEvent="BtnSearch_Click"></Click>
                            </DirectEvents>                        
                        </ext:Button>       
                        <ext:ToolbarSeparator/>                 
                        <ext:Button runat="server" ID="BtnRefresh" Text="刷新" Icon="ArrowRefresh" >                           
                               <Listeners>
                                    <Click Handler="#{StoreExpressInfo}.reload();"  />
                                </Listeners>                          
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <SelectionModel> 
             <ext:CheckboxSelectionModel  runat="server" Mode="Multi" CheckOnly="true" />
            </SelectionModel>
            <ColumnModel runat="server">
			    <Columns>
                    <ext:Column runat="server" Header="ID" DataIndex="ID" Width="150" Hidden="true" />
                    <ext:Column  runat="server" Header="标题" DataIndex="Title" Width="100" />
                    <ext:DateColumn  runat="server" Header="发布日期" DataIndex="OperatorTime" Format="yyyy-MM-dd HH:mm" />
                    <ext:Column  runat="server" Header="是否发布" DataIndex="Status" Width="100">
                         <Renderer Fn="StatusRaw" />
                    </ext:Column>
                    <ext:Column  runat="server" Header="是否推荐" DataIndex="IsRecommend" Width="100">
                         <Renderer Fn="isRecommend" />
                    </ext:Column>
                    
                    <ext:CommandColumn  runat="server" Width="120">
                        <Commands >
                            <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="编辑" />   
                            <ext:GridCommand Icon="Delete"  CommandName="Delete" Text="删除" />                         
                        </Commands>             
                        <DirectEvents>
                            <Command OnEvent="Command">
                                <ExtraParams>
                                     <ext:Parameter Name="Id" Value="record.getId()" Mode="Raw" />
                                     <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                </ExtraParams>
                               <Confirmation BeforeConfirm="if (command=='Edit') return false;" ConfirmRequest="true" Message="是否删除该记录?" Title="提示" />
                            </Command>
                        </DirectEvents>
                    </ext:CommandColumn>
			    </Columns>
                
            </ColumnModel>
            <Listeners>
            </Listeners> 
            <View>
                <ext:GridView  runat="server" />
            </View>    
            <BottomBar>
                <ext:PagingToolbar 
                    runat="server"                      
                    DisplayInfo="true" 
                    DisplayMsg="当前显示记录: {0} - {1}  共计: {2}" 
                    EmptyMsg="没有记录可以显示" 
                    
                    />
            </BottomBar>
        </ext:GridPanel>
        </Items>
        </ext:ViewPort>
        <uc1:HelperInfoEdit ID="HelperInfoEditWindow" runat="server" />
        <uc1:ExpressInfoSearch ID="ExpressInfoSearchWindow" runat="server" />
    </form>
</body>
</html>
